<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="/js-test-resources/js-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script type="text/javascript">
description("Make sure WebSocket gives errors on long invalid upgrade header.");

window.jsTestIsAsync = true;

function finish() {
    clearTimeout(timeoutID);
    finishJSTest();
}

var ws = new WebSocket("ws://127.0.0.1:8880/long-invalid-header");
ws.onopen = function () {
    debug("WebSocket is open");
};
ws.onclose = function () {
    debug("WebSocket is closed");
    finish();
};
ws.onerror = function(errorEvent)
{
    testPassed("onerror() was called");
};
var timeoutID = setTimeout("finish()", 2000);

</script>
</body>
</html>
